/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ec.socialfun.entidades;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author xavier
 */
@Entity
@Table(name = "locales_formas_de_pago")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "LocalesFormasDePago.findAll", query = "SELECT l FROM LocalesFormasDePago l"),
    @NamedQuery(name = "LocalesFormasDePago.findByLoFpCodigo", query = "SELECT l FROM LocalesFormasDePago l WHERE l.loFpCodigo = :loFpCodigo"),
    @NamedQuery(name = "LocalesFormasDePago.findByLoFpEstado", query = "SELECT l FROM LocalesFormasDePago l WHERE l.loFpEstado = :loFpEstado"),
    @NamedQuery(name = "LocalesFormasDePago.recuperaPorLocalYFormaPago", query = "SELECT l FROM LocalesFormasDePago l WHERE l.fpCodigo.fpCodigo = :fpCodigo AND l.loCodigo.loCodigo = :loCodigo"),
    @NamedQuery(name = "LocalesFormasDePago.recuperaPorEstadoYLocal", query = "SELECT l FROM LocalesFormasDePago l WHERE l.loFpEstado = :loFpEstado AND l.loCodigo.loCodigo = :loCodigo")})
public class LocalesFormasDePago implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "LO_FP_CODIGO")
    private Integer loFpCodigo;
    @Basic(optional = false)
    @Column(name = "LO_FP_ESTADO")
    private String loFpEstado;
    @JoinColumn(name = "LO_CODIGO", referencedColumnName = "LO_CODIGO")
    @ManyToOne(optional = false)
    private Local loCodigo;
    @JoinColumn(name = "FP_CODIGO", referencedColumnName = "FP_CODIGO")
    @ManyToOne(optional = false)
    private FormasDePago fpCodigo;

    public Local getLoCodigo() {
        return loCodigo;
    }

    public void setLoCodigo(Local loCodigo) {
        this.loCodigo = loCodigo;
    }

    public FormasDePago getFpCodigo() {
        return fpCodigo;
    }

    public void setFpCodigo(FormasDePago fpCodigo) {
        this.fpCodigo = fpCodigo;
    }

    public LocalesFormasDePago() {
    }

    public LocalesFormasDePago(Integer loFpCodigo) {
        this.loFpCodigo = loFpCodigo;
    }

    public LocalesFormasDePago(Integer loFpCodigo, String loFpEstado) {
        this.loFpCodigo = loFpCodigo;
        this.loFpEstado = loFpEstado;
    }

    public Integer getLoFpCodigo() {
        return loFpCodigo;
    }

    public void setLoFpCodigo(Integer loFpCodigo) {
        this.loFpCodigo = loFpCodigo;
    }

    public String getLoFpEstado() {
        return loFpEstado;
    }

    public void setLoFpEstado(String loFpEstado) {
        this.loFpEstado = loFpEstado;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (loFpCodigo != null ? loFpCodigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof LocalesFormasDePago)) {
            return false;
        }
        LocalesFormasDePago other = (LocalesFormasDePago) object;
        if ((this.loFpCodigo == null && other.loFpCodigo != null) || (this.loFpCodigo != null && !this.loFpCodigo.equals(other.loFpCodigo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.ec.socialfun.entidades.LocalesFormasDePago[ loFpCodigo=" + loFpCodigo + " ]";
    }
}
